Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DateTime week of year formats and getter #19214

Closed
wants to merge 1 commit into from
Closed

Add DateTime week of year formats and getter #19214

wants to merge 1 commit into from

Conversation

wilbertom
Copy link

Hey, I have some Python scripts I am rewriting in Nim. They make use of the week of year while formatting datetimes into strings.

Here I'm porting that functionality. I understand if its not desired in Nim though.

Here are some references where I got some of the code from and other people requiring it:

https://forum.nim-lang.org/t/6320
https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_a_month_and_day_of_the_month_or_ordinal_date

I debated making YearWeekRange be 1..53 but went with 0..52 to match Python.

Its worth pointing out this is my first time writing Nim and don't know the internals of DateTime so a strong code review is recommended.

@ringabout
Copy link
Member

Hello, @wilbertom thanks for making this PR, see also #17223

@wilbertom
Copy link
Author

Hey @xflywind , totally missed that, thank you for pointing me to it.

I'm glad someone else is thinking about this.

I think something missing on #17223 is format/parse support but, that can be added easily once that other PR is merged.

@wilbertom wilbertom closed this Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants